using System;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;
using MvcMall.Core.Domains;

namespace MvcMall.Data.NHibernateMaps
{
    public class GoodsCategoryMap : IAutoMappingOverride<GoodsCategory>
    {
        public void Override(AutoMapping<GoodsCategory> mapping)
        {
            mapping.Table("GoodsCategories");
            mapping.References(c => c.ParentCat).Column("ParentId");
            mapping.HasMany(c => c.ChildCats).KeyColumn("ParentId");
            mapping.HasMany(c => c.GoodsBrands).KeyColumn("GoodsCatId");
        }
    }
}